<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
<html dir='ltr'>
<head>
	<title>fugu</title>	
	<link rel='stylesheet' type='text/css' href='css/site.css'/>
	<script type='text/javascript' src='jquery-1.6.2.min.js'></script>
	<script type='text/javascript' src='entity.js'></script>
	
    <script>
    // http://paulirish.com/2011/requestanimationframe-for-smart-animating/
    window.requestAnimFrame = (function(){
          return  window.requestAnimationFrame       || 
                  window.webkitRequestAnimationFrame || 
                  window.mozRequestAnimationFrame    || 
                  window.oRequestAnimationFrame      || 
                  window.msRequestAnimationFrame     || 
                  function(/* function */ callback, /* DOMElement */ element){
                    window.setTimeout(callback, 1000 / 60);
                  };
    })();
    </script>
	
	<script type='text/javascript'>	
	 
       $(document).ready(function () {
			
			var world = {};
			for (var i = 1; i <= 30; i++) {
				world[i] = randomEntity(i);
			}

			var worker = new Worker("physics.js");
			worker.onmessage = function(e) {
				for (var id in e.data) {
					var entity = world[id];
					if (entity) entity.update(e.data[id]);
				}
			};
			worker.postMessage(world);
			
			var ctx = document.getElementById("canvas").getContext("2d");
			
			(function loop() {
			  ctx.clearRect(0, 0, 900, 700);
			  for (var id in world) {
				var entity = world[id];
				entity.draw(ctx);
			  }
			  requestAnimFrame(loop);
			})();
	   });
	</script>
	
</head>
<body>

<div id="container">

	<div  id="header">
			<div id="headerimg"></div>
			
			<div id="navigation">
				<ul>
					<li><a href="#">Home</a></li>
					<li><a href="#">Play</a></li>
					<li><a href="#">Editor</a></li>
					<li><a href="#">Profile</a></li>
					<li><a href="#">Forum</a></li>
					<li><a href="#">About</a></li>
				</ul>
			</div>
			
			
	</div>

	

	<div class="content">
		<div>
				<canvas id="canvas" width="640px" height="480px" ></canvas>
		</div>
	</div>
	
</div>	
	


		
</body>
</html>